package com.pro.service.imple;/*
    ClassName:LoginServiceImple
    Package:com.pro.service.imple
    Description:登录ServieImple
    @Date:2021/11/5 14:30
    @Author: 赵自强
*/

import com.pro.dao.LoginMapper;
import com.pro.entity.JsonData;
import com.pro.entity.LoginRecord;
import com.pro.entity.User;
import com.pro.service.LoginService;
import com.pro.service.NavigationBarService;
import com.pro.utils.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class LoginServiceImple implements LoginService {
    @Autowired
    private RedisCache redisCache;

    @Autowired
    private LoginMapper loginMapper;


    @Override
    public User login(String account, String password) {
        User login = loginMapper.login(account, password);
        redisCache.setCacheObject("user:"+login.getAccount(),login);
        return login;
    }

    @Override
    public Boolean addLoginRecord(LoginRecord loginRecord) {
        return loginMapper.addLoginRecord(loginRecord);
    }

    @Override
    public User judgeEnabled(String account) {
        return loginMapper.judgeEnabled(account);
    }

    @Override
    public User getUser(String account) {
        User user = loginMapper.getUser(account);
        return user;
    }
}
